<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>metisMenu - Ajax</title>

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="https://unpkg.com/metismenu/dist/metisMenu.min.css" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs/themes/prism.css" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/noty/lib/noty.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/noty/lib/themes/relax.css">

  <link rel="stylesheet" href="assets/css/app.css">

  <script>
    if (location.hostname === "mm.onokumus.com") {
      (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
          (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
          m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
      })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
  
      ga('create', 'UA-1669764-16', 'auto');
      ga('send', 'pageview', { page: location.pathname + location.search + location.hash });
    }
  </script>
  <script src="https://cdn.jsdelivr.net/npm/jquery"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
  <script src="https://unpkg.com/metismenu"></script>
  <script src="https://cdn.jsdelivr.net/npm/prismjs"></script>
  <script src="https://cdn.jsdelivr.net/npm/noty"></script>
</head>

<body>
  <header>
    <div class="navbar navbar-expand-md navbar-dark bg-dark box-shadow">
      <div class="container d-flex justify-content-between">
        <a href="index.html" class="navbar-brand d-flex align-items-center">
          <strong>metisMenu</strong>
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
          aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarsExampleDefault">
          <ul class="navbar-nav ml-auto">
  
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true"
                aria-expanded="false">Examples</a>
              <div class="dropdown-menu" aria-labelledby="dropdown01">
                <a class="dropdown-item" href="mm-vertical.html">Vertical Menu</a>
                <a class="dropdown-item" href="mm-horizontal.html">Horizontal Menu</a>
                <a class="dropdown-item" href="mm-folder.html">Folder View</a>
                <a class="dropdown-item" href="mm-vertical-hover.html">Hover Option For Desktop</a>
                <a class="dropdown-item" href="mm-animate.html">Animate</a>
                <a class="dropdown-item" href="mm-event.html">Event</a>
                <a class="dropdown-item" href="mm-event2.html">Event 2</a>
                <a class="dropdown-item" href="mm-dispose.html">Stop &amp; Start metisMenu</a>
                <a class="dropdown-item" href="mm-ajax.html">Ajax</a>
                <a class="dropdown-item" href="mm-faq.html">FAQ</a>
                <a class="dropdown-item" href="mm-bs-card.html">Bootstrap Card</a>
              </div>
            </li>
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="dropdown02" data-toggle="dropdown" aria-haspopup="true"
                aria-expanded="false">Templates</a>
              <div class="dropdown-menu" aria-labelledby="dropdown02">
                <a class="dropdown-item" href="http://chl.onokumus.com" target="_blank">Chaldene Admin</a>
                <a class="dropdown-item" href="http://elk.onokumus.com" target="_blank">Elektron Admin</a>
                <a class="dropdown-item" href="http://onokumus.github.io/twbuttons/" target="_blank">twbuttons</a>
              </div>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="http://onokumus.com" target="_blank">onokumus</a>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </header>  
  <div class="container">
    <link href="assets/css/mm-vertical.css" rel="stylesheet" type="text/css" />

<section class="jumbotron text-center">
  <h2 class="jumbotron-heading">Ajax</h2>
  <a class="btn btn-outline-info" href="assets/css/mm-vertical.css" target="_top">
  <i class="fa fa-fw fa-css3"></i>
  Download CSS
  </a>
  <a class="btn btn-outline-warning" href="assets/js/mm-ajax.js" target="_top">
  <i class="fa fa-fw fa-file-code-o"></i>
  Download JS</a>
</section>

  <div class="row">
    <div class="col-md-3">
      <nav class="sidebar-nav">
        <ul class="metismenu" id="menu">
          <li>
            <a class="has-arrow" href="#">
              <span class="fa fa-fw fa-github fa-lg"></span>
              metisMenu
            </a>
            <ul>
              <li>
                <a href="https://github.com/onokumus/metisMenu">
                  <span class="fa fa-fw fa-code-fork"></span> Fork
                </a>
              </li>
              <li>
                <a href="https://github.com/onokumus/metisMenu">
                  <span class="fa fa-fw fa-star"></span> Star
                </a>
              </li>
              <li>
                <a href="https://github.com/onokumus/metisMenu/issues">
                  <span class="fa fa-fw fa-exclamation-triangle"></span> Issues
                </a>
              </li>
            </ul>
          </li>
          <li>
            <a class="has-arrow" href="#" aria-expanded="false">Menu 0</a>
            <ul>
              <li><a href="#">item 0.1</a></li>
              <li><a href="#">item 0.2</a></li>
              <li><a href="http://onokumus.com">onokumus</a></li>
              <li><a href="#">item 0.4</a></li>
            </ul>
          </li>
          <li id="removable">
            <a class="has-arrow" href="#" aria-expanded="false">Menu 1</a>
            <ul>
              <li><a href="#">item 1.1</a></li>
              <li><a href="#">item 1.2</a></li>
              <li>
        <a class="has-arrow" href="#" aria-expanded="false">Menu 1.3</a>
        <ul>
                  <li><a href="#">item 1.3.1</a></li>
                  <li><a href="#">item 1.3.2</a></li>
                  <li><a href="#">item 1.3.3</a></li>
                  <li><a href="#">item 1.3.4</a></li>
                </ul>
              </li>
              <li><a href="#">item 1.4</a></li>
              <li>
                <a class="has-arrow" href="#" aria-expanded="false">Menu 1.5</a>
                <ul>
                  <li><a href="#">item 1.5.1</a></li>
                  <li><a href="#">item 1.5.2</a></li>
                  <li><a href="#">item 1.5.3</a></li>
                  <li><a href="#">item 1.5.4</a></li>
                </ul>
              </li>
            </ul>
          </li>
          <li>
            <a class="has-arrow" href="#" aria-expanded="false">Menu 2</a>
            <ul>
              <li><a href="#">item 2.1</a></li>
              <li><a href="#">item 2.2</a></li>
              <li><a href="#">item 2.3</a></li>
              <li><a href="#">item 2.4</a></li>
            </ul>
          </li>
        </ul>
      </nav>
    </div>

<div class="col-md-9">
        <div class="card">
      <div class="card-body">
        <h5 class="card-title">Simple Ajax</h5>
<button type="button" class="btn btn-outline-success" id="ajaxButton">
            get ajax menu
          </button>
<pre><code class="language-javascript">$(<span class="hljs-string">'#menu'</span>).metisMenu();

$(<span class="hljs-string">"#ajaxButton"</span>).one(<span class="hljs-string">'click'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> $<span class="hljs-keyword">this</span> = $(<span class="hljs-keyword">this</span>);
  $.ajax({
    <span class="hljs-attr">url</span>: <span class="hljs-string">"demo-ajax.html"</span>,
    <span class="hljs-attr">success</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">result</span>) </span>{

      $(<span class="hljs-string">'#menu'</span>).metisMenu(<span class="hljs-string">'dispose'</span>);
      $(<span class="hljs-string">"#menu"</span>).append(result);

      $(<span class="hljs-string">'#menu'</span>).metisMenu();
      $<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">'disabled'</span>, <span class="hljs-string">'disabled'</span>);
    }
  });
});
</code></pre>
      </div>
    </div>
    </div>

 
  </div>


<hr>

  <div class="row">
    <div class="col-md-3">
      <nav class="sidebar-nav">

        <ul class="metismenu" id="menu2">
          <li><a href="" class="has-arrow" data-url="ajax-1.html">Ajax Menu 1</a></li>
          <li><a href="" class="has-arrow" data-url="ajax-2.html">Ajax Menu 2</a></li>
          <li><a href="" class="has-arrow" data-url="ajax-3.html">Ajax Menu 3</a></li>
          <li><a href="" class="has-arrow" data-url="ajax-4.html">Ajax Menu 4</a></li>
        </ul>

      </nav>
    </div>

    <div class="col-md-9">
        <div class="card">
      <div class="card-body">
        <h5 class="card-title">Simple Ajax <small>one level</small></h5>
<pre><code class="language-javascript">  $(<span class="hljs-string">'#menu2'</span>).metisMenu();

  $(<span class="hljs-string">"[data-url]"</span>).each(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
      $(<span class="hljs-keyword">this</span>).one(<span class="hljs-string">'click'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">event</span>)</span>{
        event.preventDefault();
        <span class="hljs-keyword">var</span> $<span class="hljs-keyword">this</span> = $(<span class="hljs-keyword">this</span>);
        <span class="hljs-keyword">var</span> url = $<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">'data-url'</span>);
        <span class="hljs-built_in">console</span>.log(url);

        $.ajax({
          <span class="hljs-attr">url</span>: url,
          <span class="hljs-attr">success</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">result</span>) </span>{

            $(<span class="hljs-string">'#menu2'</span>).metisMenu(<span class="hljs-string">'dispose'</span>);
            $<span class="hljs-keyword">this</span>.parent(<span class="hljs-string">'li'</span>).append(result);

            $(<span class="hljs-string">'#menu2'</span>).metisMenu();

            $<span class="hljs-keyword">this</span>.click();
          }
        });

      });
  });
</code></pre>
      </div>
    </div>
    </div>

  </div>


<script src="assets/js/mm-ajax.js"></script>

  </div>

  <footer class="text-muted">
    <div class="container">
      <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
      <!-- responsive reklam -->
      <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5671633872085649" data-ad-slot="6251877391"
        data-ad-format="auto" data-full-width-responsive="true"></ins>
      <script>
        if (location.hostname === "mm.onokumus.com") {
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
      </script>
    </div>
  </footer>
</body>

</html>